<!--
 * @FilePath     : /study_code/layui/10-9.html
 * @Description  : 下拉选项数据
 * @Date         : 2025-04-09 10:34:32
 * @Author       : Fang YingGui
 * @LastEditors  : fangyinggui 18715384437@163.com
 * @LastEditTime : 2025-04-09 10:47:13
-->
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>documentName</title>
    <link rel="stylesheet" href="/layui/dist/css/layui.css" />
    <style>
      .demo-dropdown-tabs {
        padding: 0 16px;
      }
    </style>
  </head>
  <body>
    <button class="layui-btn" id="ID-dropdown-demo-content">
      自定义内容
      <i class="layui-icon layui-icon-list layui-font-14"></i>
    </button>

    <script src="/layui/dist/layui.js"></script>
    <!-- <script src="/dropdown/common.js"></script> -->
    <script>
      layui.use(function () {
        var dropdown = layui.dropdown

        // 渲染
        dropdown.render({
          elem: '#ID-dropdown-demo-content',

          data: [
            // title + id
            {
              title: 'menu item 100',
              id: 100,
            },

            // type (normal) (def)
            {
              title: 'menu item 101',
              id: 101,
              type: 'normal',
            },

            // type (group)
            {
              title: 'menu item 102',
              id: 102,
              type: 'normal',
            },

            // type (parent)
            {
              title: 'menu item 103',
              id: 103,
              type: 'parent',
            },

            // type (-)
            {
              title: 'menu item 104',
              id: 104,
              type: '-',
            },

            // href
            {
              title: 'menu item 105',
              id: 105,
              href: 'https://www.baidu.com',
              target: '_self', // target(def)
            },

            // target
            {
              title: 'menu item 106',
              id: 106,
              href: 'https://www.baidu.com',
              target: '_blank',
            },

            // disabled
            {
              title: 'menu item 107',
              id: 107,
              disabled: true,
            },

            // templet(string)
            {
              title: 'menu item 108',
              id: 108,
              templet: '<b>自定义文本</b>',
            },

            // templet(function)
            {
              title: 'menu item 109',
              id: 109,
              templet: function () {
                return '<b>自定义文本</b>'
              },
            },

            // child
            {
              title: 'menu item 110',
              id: 110,
              child: [
                {
                  title: 'menu item 10001',
                  id: 10001,
                  child: [
                    // 嵌套
                    {
                      title: 'menu item 10002-1',
                      id: 10002-1,
                    },
                    {
                      title: 'menu item 10002-2',
                      id: 10002-2,
                    },
                  ],
                },
                {
                  title: 'menu item 10002',
                  id: 10002,
                },
                {
                  title: 'menu item 10003',
                  id: 10003,
                },
              ],
            },
          ],
        })
      })
    </script>
  </body>
</html>
